package chapter02;

import lombok.Getter;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * 雇员对象
 * 
 * @author insight
 * @since 2021/8/13
 */
@Getter
@ToString
public class Employee implements Serializable {
    private static final long serialVersionUID = 1733411503902315971L;
    
    public static final int NAME_SIZE = 5;
    public static final int RECORD_SIZE = NAME_SIZE * 2 + 20;

    private String name;
    private double salary;
    private LocalDate hireDay;
    private Employee share;

    public Employee(String name, double salary, int year, int month, int day) {
        this.name = name;
        this.salary = salary;
        this.hireDay = LocalDate.of(year, month, day);
    }

    public void setShare(Employee share) { this.share = share; }
    
    public void raiseSalary(double raise) {
        this.salary += raise;
    }
}